<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="cw" uri="/widget-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>表单</title>
		<cw:base></cw:base>
		<jsp:include page="/pages/include/nocache.jsp"></jsp:include>
		<script type="text/javascript" src="${pageContext.request.contextPath}/resource/scripts/utils.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/resource/scripts/formUtils.js"></script>
		<style type="text/css">
			.gridSelect-caption {
				background-color: #D0DEF0;
			}
			.biaoti{font-size:12px;}
			.required{color:red}
		</style>
	</head>
	<body>
		<cw:tab id="formElementsTab" activeTab="0" autoScroll="false" listeners="{'tabchange':tabChg}"> 
			<cw:panel id="buttonPan" contentId="buttonDiv" title="<span class='biaoti'>按钮</span>" autoHeight="true"/>
			<cw:panel id="radioBoxPan" contentId="radioBoxDiv" title="<span class='biaoti'>单选框</span>" autoHeight="true"/>
			<cw:panel id="checkBoxPan" contentId="checkBoxDiv" title="<span class='biaoti'>复选框</span>" autoHeight="true"/>
			<cw:panel id="comboboxPan" contentId="comboboxDiv" title="<span class='biaoti'>下拉框</span>" autoHeight="true"/>
			<cw:panel id="datePan" contentId="dateDiv" title="<span class='biaoti'>日期控件</span>" autoHeight="true"/>
			<cw:panel id="filePan" contentId="fileDiv" title="<span class='biaoti'>文件上传</span>" autoHeight="true"/>
			<cw:panel id="htmlEditorPan" contentId="htmlEditorDiv" title="<span class='biaoti'>富文本框</span>" autoHeight="true"/>
			<cw:panel id="listBoxPan" contentId="listBoxDiv" title="<span class='biaoti'>列表框</span>" autoHeight="true"/>
			<cw:panel id="normalElementsPan" contentId="normalElementsDiv" title="<span class='biaoti'>基本输入框</span>" autoHeight="true"/>
			<cw:panel id="validatePan" contentId="validateDiv" title="<span class='biaoti'>表单校验</span>" autoHeight="true"/>
			<cw:panel id="formInteractionPan" contentId="formInteractionDiv" title="<span class='biaoti'>表单交互</span>" autoHeight="true"/>
		</cw:tab>
		
		<div id="buttonDiv">
			<iframe src="" id="buttonFrame" name="buttonFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="radioBoxDiv">
			<iframe src="" id="radioBoxFrame" name="radioBoxFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="checkBoxDiv">
			<iframe src="" id="checkBoxFrame" name="checkBoxFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="comboboxDiv">
			<iframe src="" id="comboboxFrame" name="comboboxFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="dateDiv">
			<iframe src="" id="dateFrame" name="dateFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="fileDiv">
			<iframe src="" id="fileFrame" name="fileFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="htmlEditorDiv">
			<iframe src="" id="htmlEditorFrame" name="htmlEditorFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="listBoxDiv">
			<iframe src="" id="listBoxFrame" name="listBoxFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="normalElementsDiv">
			<iframe src="" id="normalElementsFrame" name="normalElementsFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="validateDiv">
			<iframe src="" id="validateFrame" name="validateFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		
		<div id="formInteractionDiv">
			<iframe src="" id="formInteractionFrame" name="formInteractionFrame" width="100%" scrolling="no" noresize="noresize" 
				frameborder="0" onload="resetHeight(this);"></iframe>
		</div>
		<br>
		<cw:theme></cw:theme>
	</body>
	<script type="text/javascript">
		var buttonFlag = true;
		var radiobBoxFlag = true;
		var checkBoxFlag = true;
		var comboboxFlag = true;
		var dateFlag = true;
		var fileFlag = true;
		var htmlEditorFlag = true;
		var listBoxFlag = true;
		var normalElementsFlag = true;
		var validateFlag = true;
		var formInteractionFlag = true;
		
		Ext.onReady(function(){
			window.frames["buttonFrame"].location = "<c:url value='/sample/component/demoform/button.jsp'/>";
			buttonFlag = false;
		})
		
		function tabChg(tab,pan){
			var id = pan.id;
			if((id=="buttonPan") && (buttonFlag==true)){
				window.frames["buttonFrame"].location = "<c:url value='/sample/component/demoform/button.jsp'/>";
				buttonFlag = false;
			}else if((id=="radioBoxPan") && (radiobBoxFlag==true)){
    			window.frames["radioBoxFrame"].location = "<c:url value='/sample/component/demoform/radioBox.jsp'/>";
    			radiobBoxFlag = false;
    		}else if((id=="checkBoxPan") && (checkBoxFlag==true)){
    			window.frames["checkBoxFrame"].location = "<c:url value='/sample/component/demoform/checkBox.jsp'/>";
    			checkBoxFlag = false;
    		}else if((id=="comboboxPan") && (comboboxFlag==true)){
    			window.frames["comboboxFrame"].location = "<c:url value='/sample/component/demoform/combobox.jsp'/>";
    			comboboxFlag = false;
    		}else if((id=="datePan") && (dateFlag==true)){
    			window.frames["dateFrame"].location = "<c:url value='/sample/component/demoform/date.jsp'/>?nowtime=${request.now }";
    			dateFlag = false;
    		}else if((id=="filePan") && (fileFlag==true)){
    			window.frames["fileFrame"].location = "<c:url value='/sample/component/demoform/file.jsp'/>";
    			fileFlag = false;
    		}else if((id=="htmlEditorPan") && (htmlEditorFlag==true)){
    			window.frames["htmlEditorFrame"].location = "<c:url value='/sample/component/demoform/htmlEditor.jsp'/>";
    			htmlEditorFlag = false;
    		}else if((id=="listBoxPan") && (listBoxFlag==true)){
    			window.frames["listBoxFrame"].location = "<c:url value='/sample/component/demoform/listBox.jsp'/>";
    			listBoxFlag = false;
    		}else if((id=="normalElementsPan") && (normalElementsFlag==true)){
    			window.frames["normalElementsFrame"].location = "<c:url value='/sample/component/demoform/normalElements.jsp'/>";
    			normalElementsFlag = false;
    		}else if((id=="validatePan") && (validateFlag==true)){
    			window.frames["validateFrame"].location = "<c:url value='/sample/component/demoform/validate.jsp'/>";
    			validateFlag = false;
    		}else if((id=="formInteractionPan") && (formInteractionFlag==true)){
    			window.frames["formInteractionFrame"].location = "<c:url value='/sample/component/demoform/formInteraction.jsp'/>";
    			formInteractionFlag = false;
    		}
		}
		
		function resetHeight(t){
			window.frames[t.id].resetHeight(t.id);
		}
		
		function gotoPage(frame,page){
			window.frames[frame].location = "<c:url value='/sample/component/demoform/"+page+".jsp'/>";
		}
	</script>
</html>
